package com.longxi.tianjintianbao.ui.activity.houseinspection;

import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.ui.base.BaseActivity;
import com.longxi.tianjintianbao.ui.presenter.houseinspection.AssetsRepairAtPresenter;
import com.longxi.tianjintianbao.ui.view.houseinspection.IAssetsRepairAtView;

import butterknife.BindView;

/**
 * 入住验房里面有一个个小项目 这些项目都可以点击查看或检查 这个是检查用
 * Created by cxw on & 2018/9/20
 */
public class AssetsRepairActivity extends BaseActivity<IAssetsRepairAtView, AssetsRepairAtPresenter> implements IAssetsRepairAtView {

    @BindView(R.id.tvAssetsLeft)
    TextView mTvAssetsLeft;
    @BindView(R.id.tvAssetsRight)
    TextView mTvAssetsRight;
    @BindView(R.id.rgRepairType)
    RadioGroup mRgRepairType;
    @BindView(R.id.rgState)
    RadioGroup mRgState;
    @BindView(R.id.etExplain)
    EditText mEtExplain;
    @BindView(R.id.recyclerView)
    RecyclerView mRecyclerView;
    @BindView(R.id.btnSubmit)
    Button btnSubmit;

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_assets_repair;
    }

    @Override
    protected AssetsRepairAtPresenter createPresenter() {
        return new AssetsRepairAtPresenter(this);
    }

    @Override
    public void initView() {
        super.initView();
        mPresenter.initView();
        setTitle("资产赔偿");
    }

    @Override
    public void initData() {
        super.initData();
//        mPresenter.getCompensate();
//        mPresenter.initSelectImage(mRecyclerView, 3);
    }

    @Override
    public void initListener() {
        super.initListener();
        btnSubmit.setOnClickListener(v -> mPresenter.compensateSave());

        mRgRepairType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if(checkedId == R.id.rbtnReplace){
                    mPresenter.repairmode = "更换";
                }else{
                    mPresenter.repairmode = "赔偿";
                }
            }
        });

        mRgState.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if(checkedId == R.id.rbtnNoReturn){
                    mPresenter.recoverystate = "未恢复";
                }else{
                    mPresenter.recoverystate = "已恢复";
                }
            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
//        if (resultCode != RESULT_OK) {
//            return;
//        }
//        mPresenter.onActivityResult(requestCode, resultCode, data);
    }

    @Override
    public TextView getTvAssetsLeft() {
        return mTvAssetsLeft;
    }

    @Override
    public TextView getTvAssetsRight() {
        return mTvAssetsRight;
    }

    @Override
    public RadioGroup getRgRepairType() {
        return mRgRepairType;
    }

    @Override
    public RadioGroup getRgState() {
        return mRgState;
    }

    @Override
    public EditText getEtExplain() {
        return mEtExplain;
    }

    @Override
    public RecyclerView getRecyclerView() {
        return mRecyclerView;
    }
}
